package com.example.spinning.controller;


import javax.servlet.http.HttpServletResponse;

import com.example.spinning.service.ExcelDownloadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Controller
@RestController
@RequestMapping("/excelDownload")
public class ExcelDownloadController{
    @Autowired
    private ExcelDownloadService exceldownloadservice;

    /**

     * @param response

     * @param tableName    要导出的表名

     */

    @GetMapping("/download/{tableName}")

    public void ToExcel(HttpServletResponse response, @PathVariable("tableName") String tableName){

        exceldownloadservice.ExcelDownload(response, tableName);

    }

}

